package com.yz.crm.weixin.service.impl;


import com.yz.common.util.IDUtils;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ibatis.session.SqlSession;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * Created by DOVE on 2015/12/4.
 */
@Service
public class QRCodeServiceImpl /*implements QRCodeService */{

  /*  private static final Log log = LogFactory.getLog(QRCodeServiceImpl.class);

    @Resource
    private SqlSession sqlSession;

    @Resource
    private MongoTemplate mongoTemplate;

    private static final String COLLECTION_QRCODE_LOG = "yz_channel_qrcode_log";

    private BaseChannelInfoMapper getChannelMapper(){
        return sqlSession.getMapper(BaseChannelInfoMapper.class);
    }

    @Override
    public void saveQRCodeLogToMongo(ChannelQrcodeLog qrcodeLog) {
        qrcodeLog.setId(IDUtils.getObjectId());
        mongoTemplate.save(qrcodeLog,COLLECTION_QRCODE_LOG);
    }

    @Override
    public BaseChannelInfo queryChannelInfo(String ticket) {
        BaseChannelInfoExample example = new BaseChannelInfoExample();
        BaseChannelInfoExample.Criteria criteria = example.createCriteria();
        criteria.andTicketEqualTo(ticket);
        List<BaseChannelInfo> list = this.getChannelMapper().selectByExample(example);
        if(list == null || list.size() == 0){
            return null;
        }
        return list.get(0);
    }*/
}
